import { NgModule } from '@angular/core';
import { RouterModule, NavigationEnd, Router } from '@angular/router';
import { ToolingAccountComponent } from './tooling/account/tooling-account.component';
import { ToolingIntoComponent } from './tooling/into/tooling-into.component';
import { ToolingScrapComponent } from './tooling/scrap/tooling-scrap.component'
import { ToolingBaseInfoComponent } from './tooling/base/tooling-base-info.component';
import { ToolingReceiveComponent } from './tooling/receive/tooling-receive.component';
import { ToolingMaintainComponent } from './tooling/maintain/tooling-maintain.component';
import { ToolingLostIndexComponent } from './tooling/lost/tooling-lost-index.component';
import { ToolingLostAccountComponent } from './tooling/lost/tooling-lost-account.component';
import { ToolingDeptAccountComponent } from './tooling/account/tooling-dept-account.component';
import { ToolingMaintainAccountComponent } from './tooling/account/tooling-maintain-account.component';
import { ToolingBorrowComponent } from './tooling/borrow/tooling-borrow.component';
import { ToolingBorrowOutComponent } from './tooling/borrowout/tooling-borrow-out.component';
import { ToolingTransferComponent } from './tooling/toolingtransfer/toolingtransfer.component';
import { ToolingCancelComponent } from './tooling/cancel/tooling-cancel.component'; 

@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: '',
                children: [
                    // 工装
                    { path: 'tooling-baseinfo', component: ToolingBaseInfoComponent },
                    { path: 'tooling-account', component: ToolingAccountComponent },
                    { path: 'tooling-deptaccount', component: ToolingDeptAccountComponent },
                    { path: 'tooling-mtainaccount', component: ToolingMaintainAccountComponent },
                    { path: 'tooling-into', component: ToolingIntoComponent },
                    { path: 'tooling-receive', component: ToolingReceiveComponent },
                    { path: 'tooling-scrap', component: ToolingScrapComponent },
                    { path: 'tooling-cancel', component: ToolingCancelComponent },
                    { path: 'tooling-mtainaccount', component: ToolingMaintainAccountComponent },
                    { path: 'tooling-maintain', component: ToolingMaintainComponent },
                    { path: 'tooling-borrowin', component: ToolingBorrowComponent },
                    { path: 'tooling-borrowout', component: ToolingBorrowOutComponent },
                    { path: 'tooling-toolingtransfer', component: ToolingTransferComponent },
                    { path: 'tooling-lostindex', component: ToolingLostIndexComponent },
                    { path: 'tooling-lostaccount', component: ToolingLostAccountComponent },
                ]
            }
        ])
    ],
    exports: [RouterModule]
})
export class StockToolingRoutingModule {
    constructor(private router: Router) {
        router.events.subscribe(event => {
            if (event instanceof NavigationEnd) {
                window.scroll(0, 0);
            }
        });
    }
}
